﻿using UnityEngine;
using System.Collections;

namespace TileMapClasses
{
	public class terrainEditor : MonoBehaviour
	{

		public GameObject plainsPrefab;
		public GameObject forestsPrefab;

		// Use this for initialization
		void Awake ()
		{
			WorldGeneration.TileGenStatus += PopulateTerrainListener;		
		}

		void OnDestroy ()
		{
			WorldGeneration.TileGenStatus -= PopulateTerrainListener;		
		}

		public void PopulateTerrainListener ()
		{
			for (int i = 0; i < tileManager.Instance.AmountOfTiles; i ++) {
				Vector3 instancePos = tileManager.Instance [i].potatas.transform.position;
			
				if (tileManager.Instance [i].TerrainType == 0) {
					//put forests
					//Instantiate (forestsPrefab, new Vector3 (instancePos.x, -2, instancePos.z), Quaternion.identity);
				} else if (tileManager.Instance [i].TerrainType == 1) {
					//put shrubs
					//Instantiate (plainsPrefab, new Vector3 (instancePos.x, -1.2f, instancePos.z), Quaternion.identity);
				}
			}
		}
	
		// Update is called once per frame
		void Update ()
		{
	
		}
	}
}
